
<body style="border:solid 1px buttonface" bgcolor="black" scroll=no topmargin=1 leftmargin=1 onload="init ()">

<!-- preview image -->
   <table width=100% height=100%>
   <tr>
   <td align=center>
   <img src="<?= $href ?>?i=px" id=mainpic >
   </td>
   </tr>
   </table>
   
 
<!-- slide show script -->
<script language="javascript">
arr = new Array();
<? for ($e=0;$e<count($files);$e++) { ?>

arr[arr.length] = "<?= $files[$e] ?>";

<? } ?>

var i = 0;
function sizeshowend () {
	
	 var w=this.width;
	 var h=this.height; 
	 
		if (h>(document.body.offsetHeight-20)) {
		mainpic.src = "thumbnail.php?i=<?= $path ?>"+arr[i]+"&h="+(document.body.offsetHeight-20);  
			 
	    } else mainpic.src = arr[i]
	 
     window.setTimeout("sizeshowstart()", 5000);
     if (i<arr.length) i ++;
     else i = 0;  
     
}


function sizeshowstart () {
	  var im = new Image();
	  im.onload = sizeshowend;
	  im.src = arr[i]; 
}


function init () {
	 sizeshowstart () 
     
}
</script>
 
</body>